unit ConfiguracaoDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TConfiguracaoData }

  TConfiguracaoData = class(TMainDataModule)
    ConfiguracaoDatasource: TDatasource;
    ConfiguracaoZQuerydesc_configuracao: TStringField;
    ConfiguracaoZQueryid_configuracao: TLargeintField;
    ConfiguracaoZQueryvalor: TStringField;
    ConfiguracaoZQueryvalor_numerico: TFloatField;
    ConfiguracaoZSequence: TZSequence;
    ConfiguracaoZUpdate: TZUpdateSQL;
    ConfiguracaoZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  ConfiguracaoData: TConfiguracaoData;

implementation

uses ConnectionDM;

{ TConfiguracaoData }


procedure TConfiguracaoData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := ConfiguracaoZQuery;
   ConfiguracaoZQuery.Open;
end;
procedure TConfiguracaoData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(ConfiguracaoZQuery, 'configuracao');
end;

procedure TConfiguracaoData.CloseDataSet;
begin
  //ConfiguracaoZQuery.Close();
end;

procedure TConfiguracaoData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(ConfiguracaoZQuery, Tabela, Condicoes);
end;

initialization
  {$I configuracaodm.lrs}

end.

